package com.lz.water.monitor.util;

import com.alibaba.fastjson.JSON;
import com.lz.water.monitor.entity.User;

public final class JsonTest {

	public static void main(String[] args) {

		/**
		 * json字符串转化为对象
		 */
		String jsonString = "{userName:'Antony',password:'12',nickName:'male',status:'88888'}";
		User user = JSON.parseObject(jsonString, User.class);
		System.out.println(user.toString());

		/**
		 * 对象转化为json字符串
		 */
		String jsonStr = JSON.toJSONString(user);
		System.out.println(jsonStr);

	}

}
